package org.android.bbdroid.webservice.data;

import java.io.Serializable;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

public class Topic
  implements Iterable<Post>, Serializable
{
  private TopicInfo info;
  private List<Post> posts;

  public Topic(TopicInfo info, boolean isAuthReply)
  {
    this.info = info;
    this.info.setIsAuthReply(isAuthReply);
    this.posts = new LinkedList<Post>();
  }

  public void addPost(Post p)
  {
    this.posts.add(p);
  }

  public Post get(int idx)
  {
    return this.posts.get(idx);
  }

  public TopicInfo getTopicInfo()
  {
    return this.info;
  }

  public Iterator<Post> iterator()
  {
    return this.posts.iterator();
  }

  public int size()
  {
    return this.posts.size();
  }
}